
<h1><span class="yiyi-st" id="yiyi-12">numpy.testing.decorators.slow</span></h1>
        <blockquote>
        <p>原文：<a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.testing.decorators.slow.html">https://docs.scipy.org/doc/numpy/reference/generated/numpy.testing.decorators.slow.html</a></p>
        <p>译者：<a href="https://github.com/wizardforcel">飞龙</a> <a href="http://usyiyi.cn/">UsyiyiCN</a></p>
        <p>校对：（虚位以待）</p>
        </blockquote>
    
<dl class="function">
<dt id="numpy.testing.decorators.slow"><span class="yiyi-st" id="yiyi-13"> <code class="descclassname">numpy.testing.decorators.</code><code class="descname">slow</code><span class="sig-paren">(</span><em>t</em><span class="sig-paren">)</span><a class="reference external" href="http://github.com/numpy/numpy/blob/v1.11.3/numpy/testing/decorators.py#L23-L56"><span class="viewcode-link">[source]</span></a></span></dt>
<dd><p><span class="yiyi-st" id="yiyi-14">将测试标记为“慢”。</span></p>
<p><span class="yiyi-st" id="yiyi-15">慢速测试的确切定义显然是主观的和硬件相关的，但是一般来说，任何需要超过一秒或两秒的单独测试应该被标记为慢（整个套件包含数千个测试，所以即使一秒钟重大）。</span></p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name">
<col class="field-body">
<tbody valign="top">
<tr class="field-odd field"><th class="field-name"><span class="yiyi-st" id="yiyi-16">参数：</span></th><td class="field-body"><p class="first"><span class="yiyi-st" id="yiyi-17"><strong>t</strong>：callable</span></p>
<blockquote>
<div><p><span class="yiyi-st" id="yiyi-18">测试标记为慢。</span></p>
</div></blockquote>
</td>
</tr>
<tr class="field-even field"><th class="field-name"><span class="yiyi-st" id="yiyi-19">返回：</span></th><td class="field-body"><p class="first"><span class="yiyi-st" id="yiyi-20"><strong>t</strong>：callable</span></p>
<blockquote class="last">
<div><p><span class="yiyi-st" id="yiyi-21">装饰测试<em class="xref py py-obj">t</em>。</span></p>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
<p class="rubric"><span class="yiyi-st" id="yiyi-22">例子</span></p>
<p><span class="yiyi-st" id="yiyi-23"><code class="xref py py-obj docutils literal"><span class="pre">numpy.testing</span></code>模块包括<code class="docutils literal"><span class="pre">导入</span> <span class="pre">装饰</span> <span class="pre">为</span> <span class="pre">dec</span> t2&gt;。测试可以装饰成慢如下：</code></span></p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">numpy.testing</span> <span class="k">import</span> <span class="o">*</span>

<span class="nd">@dec</span><span class="o">.</span><span class="n">slow</span>
<span class="k">def</span> <span class="nf">test_big</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&apos;Big, slow test&apos;</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>
